import configparser
from config.config import cm

#根据实际定义
host='host'
driver='driver'

class ReadConfig:
    #ini配置文件

    def __init__(self,ini_file):
        self.file = ini_file
        self.config = configparser.RawConfigParser()
        self.config.read(self.file,encoding='utf-8')

    def _get(self,section,option):
        #获取
        return self.config.get(section,option)

    def _set(self,section,option,value):
        #更新
        self.config.set(section,option,value)
        with open(cm.ini_file,'w')as f:
            self.config.write(f)

    @property
    def web_url(self):
        return self._get(host,'host')

    @property
    def web_driver_process(self):
        return self._get(driver,'driver_process')

web_cfg = ReadConfig(cm.web_ini_file)

